const express=require('express')
const { getArtCates } = require('../router_handler/artcate')
const router=express.Router()
//验证规则中间件
const expressJoi=require('@escook/express-joi')
const { add_cate_schema,delete_cate_schema,get_cate_schema,update_cate_schem } = require('../schema/schema')


const artCate_handler=require('../router_handler/artcate')
//文章数据
router.get('/cates',artCate_handler.getArtCates)
//新增文章分类
router.post('/addcates',expressJoi(add_cate_schema),artCate_handler.addArticleCates)
//删除分类
router.delete('/deletecate/:id',expressJoi(delete_cate_schema),artCate_handler.deleteArtCateById)
//根据ID获取文章分类
router.get('/cates/:id',expressJoi(get_cate_schema),artCate_handler.getArtCatesById)
//根据ID更新文章分类
router.post('/updatecate',expressJoi(update_cate_schem),artCate_handler.updateArtCatesById)

module.exports=router